
/*
 * @Author: your name
 * @Date: 2020-05-14 10:31:50
 * @LastEditTime: 2020-10-29 14:21:38
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /yigo/src/Pages/OrderListScreen.js
 */
import React, { Component } from 'react'
import { View,
         Text ,
         Image, 
         ScrollView,
         StyleSheet, 
         TouchableOpacity
        } from 'react-native'
import { Business_OrderStatus,motor_OrderStatus } from '../Utils/Util'
import TabBar from 'react-native-tabs-top'

import BusinessOrderListScreen from '../Pages/Business/BusinessOrderListScreen'

export default class OrderStatusListScreen extends Component {
    constructor(props) {
        super(props)
        
          this.state = {
            keywords:null,       //搜索关键字
            data:[],
            index:0,             //选中菜单栏第几项
            status:null          //选中项的订单状态
        }
        this.page = 0;    // 默认第0页
    }

    onChange(index) {
        this.setState({index})
    }
    render() {
        let data = []
        let status;
        if (userInfo.userType === 1) {
            data = Business_OrderStatus
            status = this.state.index
        } else if (userInfo.userType === 2) {
            data = motor_OrderStatus
            status = this.state.index + 2;
        }
        console.log("订单状态:",status);
        return (
            <View style={{flex:1}}>
                <TabBar ref={e => this.tabs = e}
                    index={this.state.index}
                    data={data}
                    onChange={(index) => this.setState({index})}>        
                </TabBar>
                  <BusinessOrderListScreen status={status}></BusinessOrderListScreen>
                
            </View>
        )
    }

}

// const mapStateToProps = (state) => {
//     let { isFetch, code, data, msg} = state.Order.orderList || '';    
    
//     return { 
//         isFetch, code, data, msg
//             } 
// }

// const mapDispatchToProps = (dispatch, ownProps) => {
//     return {
//         orderList: (paramter)=> dispatch(orderList(paramter))

//     }
// }




// class OrderList extends Component {
//     constructor() {
//         super()
//         this.state = {
//             keywords:null,       //搜索关键字
//             data:[]
//         }
//         this.page = 0;    // 默认第0页
//     }

//     componentDidMount() {
//         let status = this.props.status;
//         this.fetchList(status)
//     }
//     fetchList(status) {
//         console.log("第几项:",this.props.status);
//         this.props.orderList({status})
//     }

//     render() {
//         return (
//             <View style={{flex:1,backgroundColor:'#F8F8F8'}}>
//                 <CustomFlatList 
//                     renderItem={this._renderItem}
//                     lookMoreClick={() => this.refreshData(true)}
//                     data={this.state.data}>
//                 </CustomFlatList>
//             </View>
//         );
//     }

//     lookMoreClick = () => {
    
//     }

//     onSearchChange(keywords) {        
//         this.setState({keywords})
//     }  
//     _renderItem = ({item,index}) => (

//         <View style={{backgroundColor:'#F8F8F8',height:184}}>
//             <View style={{backgroundColor:'#dcdcdc',height:1}}></View>
//             <Text>{item.userName}</Text>
//             <Text>{item.userPhone}</Text>
//             <Text>{`${item.orderPrice}元`}</Text>
    
//         </View>
//      );
//     _keyExtractor = (item, index) => item.id;
// }

// const mapStateToProps = (state) => {
//     let { isFetch, code, data, msg} = state.Order.orderList || '';    
    
//     return { 
//         isFetch, code, data, msg
//             } 
// }

// const mapDispatchToProps = (dispatch, ownProps) => {
//     return {
//         orderList: (paramter)=> dispatch(orderList(paramter))
//     }
// }


//  export const comm = connect(mapStateToProps, mapDispatchToProps)(OrderList)

